package com.dzu.easy;

/**
 * @author ZhaoDong
 * @date 2022/10/20 10:19
 * @description 面试题 08.01. 三步问题
 */
public class Test0801 {
    public static void main(String[] args) {
        System.out.println(waysToStep(61));
    }

    public static int waysToStep(int n) {
        if (n <= 2) {
            return n;
        }
        int[] dp = new int[n + 1];

        dp[0] = 1;
        dp[1] = 1;
        dp[2] = 2;

        for (int i = 3; i <= n; i++) {
            dp[i] = ((dp[i - 1] + dp[i - 2]) % 1000000007 + dp[i - 3]) % 1000000007;
        }
        return dp[n];

    }

}
